/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package neo.workforce.dao.impl;

import java.util.List;
import neo.workforce.dao.Action;
import neo.workforce.dao.ActionDAO;
import neo.workforce.dao.CommonDAO;
import org.apache.log4j.Logger;

/**
 *
 * @author krisada
 */
public class ActionDAOImpl extends CommonDAO implements ActionDAO {
    
    private static final long serialVersionUID = 4703189411323953795L;

    private Logger log = Logger.getLogger(this.getClass());
        
    public Action find(long id) {
        return (Action)this.find(Action.class, id);
    }

    public Long save(final Action action) {
        return super.save(action);
    }

    public boolean update(Action action) {
        return super.update(action);
    }

    public boolean remove(long id) {
        return super.remove(Action.class, id);
    }

    public List findAll(long activityId) {
        StringBuilder buf = new StringBuilder();
        buf.append("FROM neo.workforce.dao.Action o WHERE o.activity.id = ").append(activityId).append(" desc o.createDate");
        log.info(buf.toString());
        java.util.List ls = getHibernateTemplate().find(buf.toString());
        return ls;
    }

    public List findByName(String actionName, long activityId) {
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }

    public List findByName(int begin, int limit, String actionName, long activityId) {
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }
    
    
}
